#include <iostream>
using namespace std;
class A{
	private:
		int x,y;
	public:
		A(){
			x=1;
			y=2;
		}
		A(int x,int y){
			this->x=x;
			this->y=y;
		}
		void Out(){
			cout<<"x="<<x<<endl;
			cout<<"y="<<y<<endl;
		}
		~A(){
			cout<<"A died"<<endl;
		}
};

class C{
	private:
		int z;
	public:
		C(){
			z=3;
		}
		C(int z){
			this->z=z;
		}
		void Out(){
			cout<<"z="<<z<<endl;
		}
		~C(){
			cout<<"C died"<<endl;
		}
};

class B{
	private:
		A objA;
		C objC;
	public:
		B(int i):objA(i+1,i-1),objC(i){
		}
		void Out(){
			objA.Out();
			objC.Out();
		}
		~B(){
			cout<<"B died"<<endl;
		}
};

int main(void){
	B objB(8);
	objB.Out();
	return 0;
}






